/*
#-----------------------------------------------------------------------------
# Name:        main.cpp
# Purpose:
#
# Author:      Seiji Morikami
#
# Created:     20011/12/09
# Copyright:   (c) 2011
# Licence:     See stegppm.license.txt
#-----------------------------------------------------------------------------
*/


#include <iostream>
#include <sstream>

#include "typedef.h"
#include "stegos.hpp"

#include "zlibw.h"
#include "steganalyzer.hpp"
#include "fileutils.hpp"

int main(int argc, char *argv[])
{

    ui_t bitdepth = 1;

    if(1==argc)
    {

        std::cout<<"\nStegppm - Seiji Morikami, 2011"
                 <<"\nUsage:"
                 <<"\n\tstegppm insert stegfile coverfile outputfile"
                 <<"\n\tstegppm recover coverfile outputfile"
                 <<"\n\tstegppm info coverfile"
                 <<"\n\tstegppm analyze coverfile"<<std::endl;
        return 0;
    }

    str_t argv1 = argv[1];

    if(3 == argc)
    {
        if( 0 == argv1.compare("info") )
        {
            Stegos::info(bitdepth, argv[2]);
        }
        else if ( 0 == argv1.compare("analyze") )
        {
            ui_t width = 0, height = 0;
            vuc_t imagedata;
            FileUtils::openPPMFile(argv[2], width, height, imagedata);

            StegAnalyzer::chiSquaredTest(bitdepth, imagedata);
        }
    }

    if(4 == argc)
    {
        if( 0 == argv1.compare("recover") )
        {
            Stegos::recover(bitdepth, argv[2], argv[3]);
        }
    }

    if(5 == argc)
    {
        if( 0 == argv1.compare("insert") )
        {
            Stegos::insert(bitdepth, argv[2], argv[3], argv[4]);
        }
    }

    return 0;
}
